#!/bin/bash
# 定义配置文件路径
config_file="/etc/keystone/keystone.conf"
# 读取密码
# read -s -p "请输入数据库密码: " db_password
echo "" > $config_file
cat << EOF > $config_file
[database]
connection = mysql+pymysql://keystone:openpass@controller/keystone
[cache]
backend = oslo_cache.memcache_pool
enabled = true
memcache_servers = localhost:11211
EOF
echo "yum install openstack-keystone -y"
yum install openstack-keystone -y

useradd keystone
usermod -s /bin/bash keystone
su -s /bin/sh -c "keystone-manage db_sync" keystone
 
keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
keystone-manage credential_setup --keystone-user keystone --keystone-group keystone
 
export ADMIN_PASS=openpass
 
keystone-manage bootstrap --bootstrap-password openpass \
 --bootstrap-admin-url http://controller:5000/v3/ \
 --bootstrap-internal-url http://controller:5000/v3/ \
 --bootstrap-public-url http://controller:5000/v3/ \
 --bootstrap-region-id RegionOne
openstack role list # 查看OpenStack云计算平台现有的角色列表
